﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using Syspetro.Core.ErrorException;

namespace Syspetro.Core.EventBus
{
    public interface IEventBase
    {
        /// <summary>
        /// 事件发生的时间
        /// </summary>
        DateTime EventTime { get; set; }
        /// <summary>
        /// 重试次数
        /// </summary>
        int Retry { get; set; }
        /// <summary>
        /// 执行结束标志
        /// </summary>
        bool Finished { get; set; }
    }

    /// <summary>
    /// 事件源
    /// </summary>
    public interface IEventData<T> : IEventBase
    {
        /// <summary>
        /// 触发事件需要的输入参数
        /// </summary>
        T EventSource { get; set; }
    }
    /// <summary>
    /// 
    /// </summary>
    public class EventBase : IEventBase
    {
        public DateTime EventTime { get; set; } = DateTime.Now;
        public int Retry { get; set; } = 0;
        public bool Finished { get; set; } = false;
    }
}
